<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>投诉列表</title>
    <link rel="stylesheet" th:href="@{/src/css/layui.css}">
</head>
<body>
<table id="proList" class="proList" lay-filter="proList"></table>
<script type="text/html" id="sratus">
    {{#  if(d.status == 0){ }}
    <span>未处理</span>
    {{#  } else if(d.status == 1) { }}
    <span>处理中</span>
    {{#  } else if(d.status == 2) { }}
    <span>已处理</span>
    {{#  } }}
</script>
<script type="text/html" id="type">
    {{#  if(d.complainType == 0){ }}
    <span>动态</span>
    {{#  } else if(d.complainType == 1) { }}
    <span>商品</span>
    {{#  } else if(d.complainType == 2) { }}
    <span>服务</span>
    {{#  } else if(d.complainType == 3) { }}
    <span>活动</span>
    {{#  } }}
</script>
<script type="text/html" id="barEdit">
    <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit">处理投诉</a>
</script>
<script th:src="@{/src/layui.js}"></script>
<script>
    layui.use(['jquery','layer','laypage','laytpl','table','form'],function () {
        var $ = layui.jquery,
            layer = layui.layer,
            laypage = layui.laypage,
            laytpl = layui.laytpl,
            table = layui.table,
            form = layui.form;
        table.render({
            elem:'#proList',
            url:'/complain/list',
            title:'投诉列表',
            page:true,
            limit:10,
            cols:[
                [
                    {type:'checkbox'},
                    {title:'ID',field:'id',width:50},
                    {title:'投诉账户',field:'account'},
                    {title:'投诉内容',field:'content'},
                    {title:'投诉类型',field:'complainType',templet:'#type'},
                    {title:'审核状态',field:'status',templet:'#sratus'},
                    {title:'投诉时间',field:'complainTime'},
                    {title:'处理时间',field:'disposeTime'},
                    {title:'操作',templet:'#barEdit'}
                ]
            ],
            parseData:function(result){
                return {
                    code:result.code==200?0:result.code,
                    msg:result.message,
                    count:result.data.total,
                    data:result.data.list
                }
            }
        });
        //监听表格的行工具事件
        table.on('tool(proList)',function (row) {
            var data = row.data;
            if(row.event === 'edit'){
                layer.open({
                    type:2,
                    title:'处理投诉',
                    area:['400px','600px'],
                    content:'/complain/preDispose?id='+data.id
                });
            }
        })


    })
</script>

</body>
</html>